<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ include file="/WEB-INF/page/include/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta charset="utf-8">
	<title>文章列表</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport"
		  content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
	<meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
	<link rel="stylesheet" href="${ctx }/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="${ctx }/css/font_eolqem241z66flxr.css"
		  media="all" />
	<link rel="stylesheet" href="${ctx }/css/list.css" media="all" />

	<script>
        var ctx = "${ctx}";
	</script>
</head>

</head>
<body>

<div class="childrenBody" id="rrapp">
	<input type="hidden" id="adminId"
		   value="<shiro:principal property="id"/>" />
	<blockquote class="layui-elem-quote list_search">
		<%--<shiro:hasPermission name="xinyongka:xinyongka:save">--%>
		<div class="layui-inline">
			<a class="layui-btn layui-btn-normal cardAdd_btn" id="cardAdd_btn"><i
					class="layui-icon">&#xe608;</i> 添加类别</a>
		</div>
		<%--</shiro:hasPermission>--%>
		<shiro:hasPermission name="sys:admin:delete">
			<div class="layui-inline">
				<a class="layui-btn layui-btn-danger batchDel"><i
						class="layui-icon">&#xe640;</i>批量删除</a>
			</div>
		</shiro:hasPermission>
		<%--<div class="layui-inline">--%>
		<%--<div class="layui-form-mid layui-word-aux"><a class="layui-btn layui-btn-danger" id="testdata" ><i--%>
		<%-->&#xe640;</i>测试数据</a>--%>
		<%--</div>--%>
		<%--</div>--%>
	</blockquote>

	<table class="layui-table" lay-data="{ url:'${ctx}/categories/list', method:'post',  page:true, id:'listTable'}" lay-filter="list">
	  <thead>
	    <tr>
	      <th lay-data="{type:'checkbox', fixed: 'left'}"></th>
		   <th lay-data="{field:'id',width:40}">ID</th>
		   <th lay-data="{field:'name',width:120}">名称</th>
		   <th lay-data="{field:'image',width:650}">图片</th>
		   <th lay-data="{field:'shoufei',width:100,templet:'#sfTpl'}">是否收费</th>
		   <th lay-data="{field:'sort',width:60}">排序</th>
		   <%--<th lay-data="{field:'createdAt'}"></th>--%>
		   <%--<th lay-data="{field:'updatedAt'}"></th>--%>
		   <%--<th lay-data="{field:'deletedAt'}"></th>--%>
			<th lay-data="{fixed: 'right', align:'center', toolbar: '#bar',width:150}">操作</th>
	    </tr>
	  </thead>
	</table>
	<script type="text/javascript" src="${ctx }/layui/layui.js"></script>
	<script type="text/javascript" src="${ctx }/page/categories/categories.js"></script>
	<script type="text/html" id="bar">
		<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
		<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
	</script>
	<script type="text/html" id="sfTpl">
		{{#  if(d.shoufei === 0){ }}
		<span style="color: #F581B1;">否</span>
		{{#  } else if(d.shoufei === 1){ }}
		是
		{{#  } else{ }}
		未填写
		{{#  } }}
	</script>
	<%--<script type="text/html" id="titleTpl">--%>
	<%--<div>{{ formatTime(d.createdAt,"yyyy-MM-dd")}}</div>--%>

	<%--</script>--%>
</div>

<script>

    function formatTime(datetime,fmt){
        var unixTimestamp = new Date(datetime*1000);
        datetime = unixTimestamp.toLocaleString()
        if (parseInt(datetime)==datetime) {
            if (datetime.length==10) {
                datetime=parseInt(datetime)*1000;
            } else if(datetime.length==13) {
                datetime=parseInt(datetime);
            }
        }
        datetime=new Date(datetime);
        var o = {
            "M+" : datetime.getMonth()+1,                 //月份
            "d+" : datetime.getDate(),                    //日
            "h+" : datetime.getHours(),                   //小时
            "m+" : datetime.getMinutes(),                 //分
            "s+" : datetime.getSeconds(),                 //秒
            "q+" : Math.floor((datetime.getMonth()+3)/3), //季度
            "S"  : datetime.getMilliseconds()             //毫秒
        };
        if(/(y+)/.test(fmt))
            fmt=fmt.replace(RegExp.$1, (datetime.getFullYear()+"").substr(4 - RegExp.$1.length));
        for(var k in o)
            if(new RegExp("("+ k +")").test(fmt))
                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
        return fmt;
    }

</script>
</body>
</html>

